package com.ren.user.controller.feign;


import com.ren.feign.entity.ReclUserVo;
import com.ren.user.service.ReclUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author RZY
 * @since 2022-07-13
 */

@Api(tags = "用户远程feign接口")
@RestController
@RequestMapping("/recl-user")
public class ReclFeignUserController {

    @Autowired
    ReclUserService userService;

    @ApiOperation(value = "远程批量查询Fm用户信息")
    @GetMapping("/remote-fm-users-info")
    public List<ReclUserVo> getRemoteFmUsersInfo(@RequestParam List<Long> userIds) {
        if(userIds.isEmpty()) return new ArrayList<>();
        return userService.getRemoteFmUsersInfo(userIds);
    }

    @ApiOperation(value = "远程查询单个Fm用户信息")
    @GetMapping("/remote-fm-user-info")
    public ReclUserVo getRemoteFmUserInfo(@RequestParam Long userId) {
        return userService.getRemoteFmUserInfoById(userId);
    }

    @ApiOperation(value = "远程批量查询美文用户信息")
    @GetMapping("/remote-article-users-info")
    public List<ReclUserVo> getRemoteArticleUsersInfo(@RequestParam List<Long> userIds) {
        if(userIds.isEmpty()) return new ArrayList<>();
        return userService.getRemoteArticleUsersInfo(userIds);
    }

    @ApiOperation(value = "远程查询单个美文用户信息")
    @GetMapping("/remote-article-user-info")
    public ReclUserVo getRemoteArticleUserInfo(@RequestParam Long userId) {
        return userService.getRemoteArticleUserInfoById(userId);
    }

}


